<?php
/**
 * Conversations - A lightweight BB for Xaraya
 *
 * @package modules
 * @copyright (C) 2003-2006 The Digital Development Foundation.
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @link http://www.xaraya.com
 *
 * @subpackage conversations
 * @link http://xaraya.com/index.php/release/760.html
 * @author John Cox
*/
/** 
 * Add new tag / post
 * 
 * @package Xaraya eXtensible Management System
 * @copyright (C) 2005 by the Xaraya Development Team.
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @link http://www.xaraya.org
 *
*/

/**
 * @author John Cox
 * @author jojodee
 * add new forum topic
 */

function conversations_user_preview_ajax()
{
    if (!xarVarFetch('post', 'str:1', $post, '', XARVAR_NOT_REQUIRED)) return;
    if (!xarVarFetch('tag', 'str:1', $tag, '', XARVAR_NOT_REQUIRED)) return;
    if (!xarSecurityCheck('Postcon', 1)) return;
        
    if (isset($tag)){
        $tags = explode(" ", $tag);
        $data = xarML('This post will be in the following tags');
        foreach ($tags as $new){
          $data .= "<h2>$new</h2>";
        }
    } elseif (isset($post)) {
        // TODO
        // This probably needs to go in a template...
        $data =  '<div class="con-user" style="color: red;">' . xarML('Preview What You Will Say') . ':</div>';
        $data .= '<div class="con-my-class">';
        // Need to add the hooks right here.
        $data .= nl2br($post);
        $data .= '</div>';
        $data .= '<div class="con-time" style="color: red;">' . xarML('Not Yet Posted') . '</div>';
    }
    // Return the output
    return $data;
}

?>